<?php

namespace App\View\Components\Frontend;

use App\Models\Article;
use Illuminate\View\Component as BaseComponent;


class Newest extends BaseComponent
{
    // 最新的10篇文章
    public function __construct()
    {
    }

    /**
     * 将一个视图或者字符串传递给组件用于渲染
     *
     * @return \Illuminate\View\View|\Closure|string
     */
    public function render()
    {
        $articleDb = new Article();
        $newest    = $articleDb->getList(['status' => 1], 10, 'id DESC');

        return view('frontend.components.newest', ['newest' => $newest]);
    }
}


